﻿using System.Collections.Generic;
using System.Linq;
using RRRSRoguelike.Entities;
using RRRSRoguelike.Entities.Creatures;

namespace RRRSRoguelike.Helpers
{
	/// <summary>
	/// Describes Simple Battle class.
	/// </summary>
	public static class SimpleBattle
	{
		//changed to static
		public static void Fight(Player player, IList<Monster> monsters)
		{
			//get the monster on same square as player with the most hits
			var monster = monsters.OrderBy(m => m.Hits).FirstOrDefault();

			// if the player has a sword kill monster or...

			if (player.HasWeapon())
			{
				//use sword - has limited uses
				player.WeaponSlot.Use(player);

				//Kill monster
				player.Kill(monster);

			}
			else
			{
				//Kill player
				monster.Kill(player);
			}
		}
	}
}
